package com.ld.control.business.equipment.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ld.control.business.equipment.model.EquipmentDataFieldConfigModel;
import com.ld.control.business.equipment.model.EquipmentModel;
import com.ld.control.business.equipment.vo.external.EquipmentCommandSendParamReqVo;
import com.ld.control.business.equipment.vo.req.EquipmentReqVo;
import com.ld.control.business.equipment.vo.resp.EquipmentDataFieldConfigRespVo;
import com.ld.control.business.equipment.vo.resp.EquipmentRespVo;
import com.ld.control.business.equipment.vo.resp.EquipmentSampleFieldShowRespVo;
import com.ld.control.common.vo.GenerateListVo;
import com.ld.control.common.vo.GeneratePageListVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 设备表 服务类
 * </p>
 *
 * @author wangfeng
 * @since 2024-04-17
 */
public interface EquipmentService extends IService<EquipmentModel> {

    /**
     * 添加设备信息
     *
     * @param reqVo
     */
    void add(EquipmentReqVo reqVo);

    /**
     * 修改设备信息
     *
     * @param reqVo
     */
    void update(EquipmentReqVo reqVo);

    /**
     * 删除设备信息
     *
     * @param id
     */
    void deleteById(Long id);

    /**
     * 获取设备详情
     *
     * @param id
     * @return
     */
    EquipmentRespVo getById(Long id);

    /**
     * 分页获取设备列表
     *
     * @param name
     * @param code
     * @param status
     * @param current
     * @param size
     * @return
     */
    GeneratePageListVo<EquipmentRespVo> getPageList(Long regionId, String name, String code, Integer status, Integer useFlag, Integer current, Integer size);


    /**
     * 根据方法模板id获取设备信息
     *
     * @param methodTmpId
     * @return
     */
    EquipmentRespVo getByMethodTmpId(Long methodTmpId);

    /**
     * 后台更新设备状态用
     */
    void backgroundUpdateEquipmentStatus();

    /**
     * 修改设备状态
     *
     * @param id
     * @param status
     */
    void updateStatus(Long id, Integer status);

    /**
     * 生成设备方法执行时间
     * @param sendCommandParams
     */
    void generateMethodEstimatedTime(EquipmentCommandSendParamReqVo sendCommandParams);

    /**
     * 获取某个任务实例下面执行了runMethod的设备
     * @param taskExampleId
     * @return
     */
    List<EquipmentRespVo> getRunMethodEquipment(@Param("taskExampleId") Long taskExampleId);

    /**
     * 获取所有设备信息Map格式
     * @return
     */
    Map<Long, EquipmentRespVo> getEquipmentRespVoAllMap();

    /**
     * 获取某个设备检测数据的表头标题
     * @param equipmentId
     * @return
     */
    List<EquipmentDataFieldConfigRespVo> getEquipmentSampleFieldShowList(Long equipmentId);

    /**
     * 获取所有的设备信息
     * @return
     */
    GenerateListVo<EquipmentRespVo> getAllList();

}
